%mex -I../Firmware ../Firmware/foc/svpwm.c ../Firmware/math/math_tables.c ../Firmware/math/fast_math.c svm.c -output svm
%mex -I../Firmware -LD:/mingw-w64/x86_64-6.3.0win32-seh-rt_v5-rev2.7/x86_64-w64-mingw32/lib ../Firmware/motor/motor.c ../Firmware/motor/mc_config.c ../Firmware/foc/controller.c ../Firmware/foc/foc.c ../Firmware/foc/svpwm.c ../Firmware/math/math_tables.c ../Firmware/math/fast_math.c ../Firmware/sim/sim_foc.c -lpthread -output sim_foc
% git://sigrok.org/libserialport， 需要把printf相关去掉，否则编译不过
mex -lpthread -lserialport -luser32 -lsetupapi -lkernel32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -LC:/msys64/mingw64/x86_64-w64-mingw32/lib -LC:/msys64/mingw64/lib -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0 -IC:/msys64/mingw64/include -LC:/msys64/mingw64/lib -I../Firmware ../Firmware/app/app.c ../Firmware/utils/crc16.c ../Firmware/utils/circle_buffer.c ../Firmware/os/os.c ../Firmware/os/heap_4.c ../Firmware/os/queue.c ../Firmware/protocols/protocol.c ../Firmware/protocols/serial.c ../Firmware/protocols/codec.c ../Firmware/protocols/command.c ../Firmware/bsp/cpu_ticks.c ../Firmware/controller/mc_config.c ../Firmware/controller/hw_samples.c ../Firmware/controller/motor.c ../Firmware/controller/controller.c ../Firmware/controller/foc.c ../Firmware/controller/svpwm.c ../Firmware/simulation/sim_bsp.c ../Firmware/simulation/sim_sfunc.c ../Firmware/simulation/sfunc_os.c ../Firmware/simulation/sfunc_core.c -O -output sim_foc  